package org.example.jwt.util;

import lombok.Data;

import java.io.Serializable;

// 确定返回格式（统一）
@Data
public class JsonResult<T> implements Serializable {
    private Boolean success; // true  false
    private T data; // 正确返回
    private Integer code; // 状态码
    private String error; // 错误返回信息

    public JsonResult() {
    }

    public JsonResult(T data) {
        this.data = data;
        this.code = 200;
        this.success = true;
    }

    public JsonResult(Integer code, String error) {
        this.code = code;
        this.error = error;
        this.success = false;
    }
}
